<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>登录 - Alex</title>

    <link href="/static/css/font-awesome.min.css-v=4.4.0.css" rel="stylesheet">
    <link href="/static/css/animate.min.css" rel="stylesheet">
    <link href="/static/css/style.min.css" rel="stylesheet">
    <!--<link href="/static/css/login.min.css" rel="stylesheet">-->
    <link href="/static/css/login-alex.css" rel="stylesheet">
    <link href="/static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/static/css/iCheck/custom.css" rel="stylesheet"/>

    <script src="/jquery/dist/jquery.min.js" type="text/javascript"></script>
    <script src="/bootstrap/dist/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="/static/js/icheck.min.js"></script>
    <script src="/static/js/alex.alert.js"></script>

    <script type="text/javascript">
        $(function () {
            //checkbox
            $(".i-checks").iCheck({
                checkboxClass:"icheckbox_square-green",radioClass:"iradio_square-green",
            });
            //login
            $("#submit").click(function () {
                var uname = $("#uname").val();
                var psw = $("#psw").val();
                var rememberMe = $("#rememberMe").prop('checked');

                if(!uname || !psw){
                    ShowFailure("用户名或密码不能为空");
                    return;
                }else {

                    var url = "/toLogin";

                    $.ajax({
                        type: "POST",
                        url: url,
                        dataType: "json",
                        data: {username: uname, password: psw, rme: rememberMe},
                        cache: false,
                        success: function (data) {

                            var code = data.code;
                            var msg = data.msg;
                            if (code == '1') {
                                window.location.href = "/index";
                            } else {
                                ShowFailure("错误信息: " + msg);
                            }
                        },
                        error: function (data) {
                            console.log("data: " + JSON.stringify(data))
                            var code = data.code;
                            var msg = data.msg;
                            ShowFailure("错误信息: " + msg);
                        }
                    });
                }
            });

            $("#zhuc").click(function () {
                window.location.href="/index";
            });

        });
    </script>
    <script>
//        if(window.top!==window.self){window.top.location=window.location};
    </script>
    <link rel="stylesheet" href="../static/bootstrap/dist/css/bootstrap.css">
</head>
<body  class="signin">
<div class="signinpanel">
    <div class="row">
        <div class="col-sm-7">
            <div class="signin-info">
                <div class="logopanel m-b">
                    <h1>[ Alex ]</h1>
                </div>
                <div class="m-b"></div>
                <!--<h4>欢迎 你，<strong>H+ 后台主题UI框架</strong></h4>-->
                <ul class="m-b">
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势一</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势二</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势三</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势四</li>
                    <li><i class="fa fa-arrow-circle-o-right m-r-xs"></i> 优势五</li>
                </ul>
                <strong>还没有账号？ <a href="#">立即注册&raquo;</a></strong>
            </div>
        </div>
        <div class="col-sm-5">
            <div class="formdiv">
                <h2 class="no-margins">登录</h2>
                <!--<p class="m-t-md">登录到H+后台主题UI框架</p>-->
                <input type="text" class="form-control uname" placeholder="用户名" id="uname" />
                <input type="password" class="form-control pword m-b" placeholder="密码" id="psw" />
                <!--<a href="">忘记密码了？</a>-->
                <div class="form-group text-left">
                    <div class="checkbox i-checks">
                        <label class="no-padding">
                            <!--name = rememberMe 是为了后端shiro的CookieRememberMeManager管理器设置-->
                            <input type="checkbox" id="rememberMe" name="rememberMe"><i></i> 记住我
                        </label>
                    </div>
                </div>

                <button class="btn btn-success btn-block" id="submit">登录</button>
            </div>
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left">
            &copy; 2018 All Rights Reserved. ALEX
        </div>
    </div>
</div>
</body>
</html>